#include "PhysicsCube.h"



void PhysicsCube::CreateGeometry()
{
	// this is going to be a cube of radius 1
	GameGeometry* cube1 = new D3DXCube(dimentions.x,dimentions.y,dimentions.z);
	cube1->SetColor(1,0,0);
	Geometry.push_back(cube1);

}

void PhysicsCube::CreatePhysicsObject()
{
	// create the shape
	hkVector4 boxSize( dimentions.x/2, dimentions.y/2, dimentions.z/2);
	havokShape = new hkpBoxShape( boxSize , 0 );

	bodyInfo.m_mass = 60.0f;
	hkpMassProperties massProperties;
	hkpInertiaTensorComputer::computeBoxVolumeMassProperties(boxSize, bodyInfo.m_mass, massProperties);

	bodyInfo.m_mass = massProperties.m_mass;
	bodyInfo.m_centerOfMass = massProperties.m_centerOfMass;
	bodyInfo.m_inertiaTensor = massProperties.m_inertiaTensor;
	bodyInfo.m_friction = 1.0;
	//bodyInfo.m_solverDeactivation = bodyInfo.SOLVER_DEACTIVATION_MEDIUM;
	bodyInfo.m_shape = havokShape;
	bodyInfo.m_allowedPenetrationDepth = 0.0f;
	//boxInfo.m_qualityType = HK_COLLIDABLE_QUALITY_DEBRIS;
	bodyInfo.m_restitution = 1.0f;

	bodyInfo.m_motionType = hkpMotion::MOTION_BOX_INERTIA;

	bodyInfo.m_position = hkVector4(Position.x,Position.y,Position.z,0);

	havokRigidBody = new hkpRigidBody(bodyInfo);
}
